/**
 * Copyright (C) 2018-2020
 * All rights reserved, Designed By www.kaikeba.co

 */
package com.jshop.seckill.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Builder;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @author yaxiongliu
 */
@Data
@Table(name = "store_order_item")
public class StoreOrderItem implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer itemid;  // 订单项id
    private Integer productId; // 商品id（线路）
    private String orderId;  // 订单id
    private Date itemtime; // 生成时间
    private Integer state;  // 支付状态
    private Integer num;  // 购买数量
    private BigDecimal subtotal; // 小计
    @Transient
    private StoreProduct product;  // 商品（线路）
    @Transient
    private StoreOrder order;  // 订单

    public StoreOrderItem() {
    }

    public void copy(StoreOrderItem source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
